/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/12 13:34
 * @copyright: 博为峰
 */
public class ArrayDemo02 {
    public static void main(String[] args) {
        /*
            语法2：数据类型[] 数组名 = new 数据类型[]{元素1,元素2,...}
         */

        int[] arr = new int[]{6, 9, 20};
        arr[0] = 66;
//        System.out.println(arr[0]);//6
        for (int a : arr) {
//            System.out.println(a);
        }

        int[] arr2 = new int[]{5, 6, 7};

        arr = arr2;

//        System.out.println(arr[0]);//5

        arr = null;

        System.out.println(arr[0]);//NullPointerException 空指针异常
    }
}
